package Simple;


/**
 * https://www.interviewstreet.com/recruit/test/view/4e14032d4e529/4ced5a1709fb1/?randhash=81433
 */

import java.io.*;
import java.util.TreeMap;

import javax.sound.midi.MidiDevice.Info;

public class Arithmetic_Progression {

	
	
	public static void main(String args[]){
		
		try {
			BufferedReader in = new BufferedReader(new FileReader("src/Simple/STDIN.txt"));
			String line= in.readLine();
			String info[] = line.split(" ");
			in.close();
			
			
			int num[] = null;
	        for(int i=0;i<info.length;i++){
	            num[i] = Integer.parseInt(info[i]);
	        }
	            
	        int temp[] = null;
	        for(int i=0;i<temp.length - 1;i++){
	           temp[i] = num[i+1] - num[i];          
	        }
	        
			TreeMap<Object, Integer> map = new TreeMap<Object, Integer>();
	        for(int i=0;i<temp.length;i++){
	            if(!map.containsKey(temp[i])){
	                map.put(temp[i],1);
	            }
	            else{
	                int count = map.get(temp[i]);
	                count++;
	                map.put(temp[i],count);
	            }
	        }
			
			System.out.println(info[1]);


		} catch (IOException e) {
		}
		
		
	}
}
